In microprocessor based input/output (I/O) controllers, for example, the typical controller architecture includes a microprocessor, a read only memory (ROM) for microprocessor instruction code storage, a read-write memory (RWM) for microprocessor work space and some amount of reserved read-write memory space for additional instruction code to be used, if needed, to "patch" (correct) ROM code "bugs" (defects) discovered after the product has been shipped to customers. The present invention is particularly useful for minimizing some of the problems associated with patching ROM code using RWM-loaded code and presents a unique solution that greatly enhances the power to do so.
The necessity for providing ROM patch capability in computer systems comes from the need to avoid the considerable financial impact of updating systems in the field by replacing the original ROM modules with new ROM modules containing corrected code. This situation arises when ROM code bugs are discovered after a goodly number of systems have been shipped to customers.
A commonly practiced method for protecting the product against this undesired event is to distribute "patch hooks" throughout key areas in the ROM code. A "patch hook" is a branch instruction which causes the processor to branch to the instruction patch area of the read-write memory. The microprocessor branches to the read-write memory space to see if an instruction routine has been loaded into that RWM space to patch or fix a ROM code problem. If it has, the microprocessor executes the RWM code and then returns back to the ROM code, usually bypassing the faulty ROM instructions. If a patch has not been loaded into the read-write memory for that patch hook, then the microprocessor simply branches back to the next sequential instruction position after its original ROM Branch instruction position and continues normal execution of ROM instructions.
This technique allows a "patch" to be written to resolve a problem in the ROM code. This patch is then distributed on a diskette to the customers who can then down load it via the appropriate software utility to the patch space in the I/O controller read-write memory. This is a much less expensive corrective method than having to manufacture and install new read only memory modules.
A major problem with this method is that it may be necessary to duplicate large amounts of ROM code in the RWM space in order to change specific lines of code, and this in turn reduces the capability for further patching. Duplicating good ROM code is usually required since finding a patch hook near the faulty ROM code is a matter of chance. For example, the nearest patch hook to a ROM bug may be located 500 instructions prior to the bug. In this case, it would be necessary to duplicate all 500 good instructions in the RWM patch, change the faulty ROM instructions and then branch back to the ROM code just beyond the bad code. Such a patch would probably exhaust the majority of the entire reserved RWM patch area and would greatly reduce the capability for providing additional patches.